<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="Public/Admin/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	    <script type="text/javascript" src="Public/Admin/jquery-1.8.2.min.js"></script>
	    <script>
	    	$(function(){
	    		//表单的提交事件
	    		$('#cargo').submit(function(){
	    			alert(1);
	    			//抓取表单所有内容
	    			$formData = $(this).serialize();
	    			alert($formData);
	    		});
	    	}
	    </script>
	    <style type="text/css">
	    	.ml30{margin-left: 30px;}
	    	.fb{color:blue;}
	    </style>
	</head>
	<body>
	<!--页面导航-->
	<div class="alert alert-success" role="alert">
		货品管理&nbsp;>&nbsp; &nbsp; <span class="fb">{{$goods_name}} </span>&nbsp;的 &nbsp;货品列表
	</div>
	<p>
		<a href="{{U('Goods/index')}}" class="btn btn-info btn-sm">返回</a>
	</p>	  	
	<form id="cargo" name="cargo" action="" method="post">
		<input type="hidden" name="goods_id" value="{{$goods_id}}" />
		<table class="table table-hover">
			<tr class="active">
			  <th width="100">货品ID</th>
			    {{if value="$arr"}}
					{{foreach from="$arr" key="$k" value="$v"}}
						<th>{{$k}}</th>
					{{endforeach}}
			    {{endif}}
			  <th>库存</th>
			  <th>货号</th>
			  <th width="200">操作</th>
			</tr>
		{{foreach from="$cargoData" value='$v'}}
			<tr>
				<td>{{$v['cargo_id']}}</td>
				{{foreach from="$v['spec']" value="$vv"}}
				<td>{{$vv}}</td>
				{{endforeach}}
				<td>{{$v['cargo_number']}}</td>
				<td>{{$v['cargo_sn']}}</td>
				
				<td>
					<a href="{{U('edit',array('cargo_id'=>$v['cargo_id'],'goods_id'=>$v['goods_goods_id']))}}" class="btn btn-sm btn-warning">编辑</a>
					<a href="javascript:if(confirm('确认删除?')) location.href='{{U('del',array('cargo_id'=>$v['cargo_id'],'goods_id'=>$v['goods_goods_id']))}}';" class="btn btn-sm btn-danger">删除</a>
				</td>
			</tr>
		{{endforeach}}
		
			<tr>
				<td>添加货品</td>
				{{foreach from="$arr" key="$k" value="$v"}}
				<td>
					<select name="spec[]">
					<option value="">-请选择-</option>
						{{foreach from="$v" key="$kk" value="$vv"}}
					<option value="{{$vv['ga_id']}}">{{$vv['ga_value']}}</option>
						{{endforeach}}
					</select>
				</td>
				{{endforeach}}
				<td><input type="text" name="cargo_number"></td>
				<td><input type="text" name="cargo_sn" placeholder="随机生成" disabled></td>
				<td></td>
			</tr>

		</table>
		<button class="btn btn-primary btn-block" type="submit"> 保存添加 </button>
	</form>
	</body>
</html>
